/* 
数据存储的工具函数模块
1. token处理
2. 登陆user处理
*/

const TOKEN_KEY = 'token_key';
const USER_KEY = 'user_key';

export const saveToken = (token) => localStorage.setItem(TOKEN_KEY, token); 

export const getToken = () => localStorage.getItem(TOKEN_KEY);

export const removeToken = () => localStorage.removeItem(TOKEN_KEY);

export const saveUser = (user) => sessionStorage.setItem(USER_KEY, JSON.stringify(user));

export const getUser = () => JSON.parse(sessionStorage.getItem(USER_KEY));

export const removeUser = () => sessionStorage.removeItem(USER_KEY);